package com.liwei.controller;

import com.liwei.model.User;
import com.liwei.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * Created by Liwei on 2015/10/31.
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/{id}")
    public String user(@PathVariable(value = "id") String id,Map<String,String> map){
        System.out.printf("id " + id);
        User user = userService.sayHello(id);
        map.put("name",user.getUserRealName());
        map.put("info","web.xml 版本信息也很重要");
        return "hello";
    }
}
